package part2;
/**
 * Java5Ex5 Example of generic class
 * 
 * @author tony
 * 
 */

class DataPair<T> {
	private T x;
	private T y;
	public DataPair(T x_in, T y_in){
		x = x_in; y = y_in;
	}
	T getx(){ return x; }
	T gety(){ return y; }
	public String toString(){
		return "( " + x + ", " + y + ") ";
	}
}

public class Java5Ex5 {
	public static void main(String[] args) {
		DataPair<Integer> dpi = new DataPair<Integer>( 5, 6 );
		System.out.println( " dpi is " + dpi );
		
		DataPair<String>  dps = new DataPair<String>( "State", "Wisconsin" );
		System.out.println( " dps is " + dps );

		DataPair<Float> dpf = new DataPair<Float>( 105.45f, -0.0056f );
		System.out.println( " dpf is " + dpf );
		
		DataPair<DataPair<Integer>> dpdpi = new DataPair<DataPair<Integer>>( dpi, new DataPair<Integer>( 73, 45) );
		System.out.println( " dpdpi is " + dpdpi );
		
	}

}
